#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int main()
{
    long m = 0;
    long n = 0;
    scanf("%ld%ld", &m, &n);
    long p = m * n;
    long t = m % n;
    while (t)
    {
        m = n;
        n = t;
        t = m % n;
    }
    long sum = p / n + n;
    printf("%.ld\n", sum);

    return 0;
}